﻿<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="UTF-8"%>
<%@ page import="com.tjsinfo.tjsoa.articles.vo.TIndexArticles"%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    String Path = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path ;
	String cid = request.getParameter("cid");
	String cname = (String)request.getAttribute("cname");
    String ctype = (String)request.getAttribute("ctype");
	String content = (String) request.getAttribute("content");
	TIndexArticles value = (TIndexArticles) request.getAttribute("articles");

	String articles_uuid = value.getUuid();
//	Integer cid = value.getCid();
	String _title = value.getTitle();
	String _author = value.getAuthor();
	String createDate = value.getCreateDate();
	String _shortTitle = value.getShortTitle();
	String _url = value.getUrl();
	String _keywords = value.getKeyWord();
	String _smallContent = value.getSmallContent();
	String _showOrder = value.getShowOrder();
    String _availableDate = value.getAvailableDate();
    String _uploadFile=value.getUploadFile();
    if (_uploadFile==null){ _uploadFile="";}
    String _smallPic=basePath.substring(0,basePath.length()-1)+value.getSmallPic();
    String _smallPicUrl;
	if (value.getSmallPic()=="NULL" ||  _smallPic.contains(basePath.substring(0,basePath.length()-1)+"NULL") ||_smallPic.contains(basePath.substring(0,basePath.length()-1)+"null"))
	{
	     _smallPicUrl="";
	}else if(value.getSmallPic().contains(Path)){
	    _smallPicUrl="<p><img alt=\"\" src=\"" + value.getSmallPic()+"\" style=\"width: 550px; height: 380px; \" /></p>";	     
	}else{
	    _smallPicUrl="<p><img alt=\"\" src=\"" + Path +value.getSmallPic()+"\" style=\"width: 550px; height: 380px; \" /></p>";
	}
    String stype="yes";
    if (ctype.indexOf("n")>0){stype="no";}  //ctype中包含‘n'，则列表界面不显示删除按钮
    String _isfile = value.getIsFile();
    
%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>天津市计算机研究所</title>
	<link href="<%=basePath%>articles/style/css.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>articles/style/houtaianniu.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/ext-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/jQuery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/init.js"></script>
    <script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/extension/panelform/TabPanel.js"></script>
    <script type="text/javascript" src="<%=basePath%>ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="<%=basePath%>ckfinder/ckfinder.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type="text/javascript" src="<%=basePath%>articles/manage/js/manageSave.js"></script>
    
  </head>
  <body>
    <div id="component" style="width:100%;height:1400px;">
    <div id="toolmenu"></div>
       <script type="text/javascript">
        parent.iFrameHeight();  
     	var cid = '<%=cid %>';
 		var basePath = '<%=basePath %>';
 		var _ctype='<%=ctype %>';
 		var name='<%=cname %>';
 		var _cname=decodeURI(name);
 		var viewtype = "viewtype"+'<%=_isfile %>';
		 Ext.onReady(function(){
		  	 var Toolbar = new Ext.Toolbar({
			        	height:28,
		                renderTo : "toolmenu"
		           });
		  	 Toolbar.add([{
		                text : "保存",
		                 iconCls: 'save',
		                handler : function(){
				        		document.getElementById('component').style.height = "600px";	
				        		parent.iFrameHeight();  
				        		formSubmit();
		                }
		            }, {
		                text : "返回",
		                iconCls: 'back',
		                handler : function(){
				        		window.location.href = basePath +'articles/manage/manageList.jsp?cid='+cid+'&type=<%out.print(stype); %>';	}
		            }]);
			/**
			 * 根据cid获取栏目名称并显示在工具栏右侧
			  	
			var  _cnamestore = new Ext.data.JsonStore({
			 		fields:['cname'],
			 		url: Ext.get('basePath').getValue()+ 'tjsinfo/tjsoa/articles/ArticlesManage.do?method=getRoleName&cid='+cid
			 	});
			    _cnamestore.on('load', function() {    
					  _cname=_cnamestore.getAt(0).get('cname');
					  Toolbar.addFill();
		              Toolbar.addText('<a style="font-weight:bold; color:black;line-height: 22px;">'+ _cname + '</a>&nbsp;&nbsp;&nbsp;'); 
					 });
				_cnamestore.load(); */	
		     Toolbar.addFill();
		     Toolbar.addText('<a style="font-weight:bold; color:black;line-height: 22px;">'+ _cname + '</a>&nbsp;&nbsp;&nbsp;'); 					
	         
		}); 
  	</script>
    <div id="xt" style="overflow-y:visible">
        <form action="<%=basePath %>tjsinfo/tjsoa/articles/Manage.do?method=updateArticles" method="post" name="form1">
          <input type="hidden" name="articles_uuid" id=articles_uuid value = "<%=articles_uuid%>"/>
          <input type="hidden" name="cid" id="cid" value = "<%=cid%>"/>
          <input id="basePath" value="<%=basePath%>" type="hidden"/>

          <div style="clear: both;margin-top: 20px;height: 100% ">
            
           <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td>  
                   <div class="tab_file10">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td colspan="2"><div>
                        <table width="100%"><tr>
	                        <td width="20%" valign="top" align="right" >&nbsp;&nbsp;&nbsp;标题:&nbsp;</td>
	                        <td align="left" width="500">
	                        <textarea name="_title" id="_title" rows="2" cols="60"><%=_title%></textarea>
	                        <font color="#FF0000">(必填)</font>
                            <td valign="top" align="center" width="150">显示顺序:</td>
                            <td align="left">
                            <input name="_showOrder" id="_showOrder" type="text" size="10" class="textinput" value="<%=_showOrder%>" onkeypress="number()" onkeyup="filterInput()" onchange="filterInput()" onbeforepaste="filterPaste()" onpaste="return false"/>
                            <input type="checkbox" id="checkboxtop" name="checkboxtop" value ="置顶" onclick="totop()"/><font color="#FF0000">置顶</font>
                            </td>
                        </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_shortTitle" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;短标题:&nbsp;</td>
                        <td align="left"><input name="_shortTitle" id="_shortTitle" type="text" size="110" class="textinput" value="<%=_shortTitle%>"/></td>
                      </tr></table>
                      </div></td>
                      </tr>
                        <tr>
                      <td colspan="2"><div id="id_author" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;作者:&nbsp;</td>
                        <td align="left"><input name="_author" id="_author" type="text" size="110" class="textinput" value="<%=_author%>"/></td>
                      </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_keywords" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;关键字:&nbsp;</td>
                        <td align="left"><input name="_keywords" id="_keywords" type="text" size="110" class="textinput" value="<%=_keywords%>"/></td>
                      </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_smallContent" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;摘要:&nbsp;</td>
                        <td align="left"><textarea name="_smallContent" id="_smallContent" rows="2" cols="110"><%=_smallContent%></textarea></td>
                      </tr></table>
                      </div></td>
                      </tr>
                                     
                      <tr><td colspan="2"><div id="id_availableDate" style='display: none;'>
                        <table width="100%"><tr>
	                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;有效时间:&nbsp;</td>
	                        <td align="left">
	                        <input name="_availableDate" type="text" size="58%" class="textinput" readonly="readonly" id="_availableDate" class="Wdate" onfocus="WdatePicker({el:'_availableDate',dateFmt:'yyyy-MM-dd'})" value="<%=_availableDate%>"/></td>
                        </tr></table>
                      </div></td></tr>
                       <tr>
                      <td colspan="2"><div id="id_url" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;超链接:&nbsp;</td>
                        <td align="left"><input name="_url" id="_url" type="text" size="68%" class="textinput" value="<%=_url%>"/></td>
                      </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_showMode" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">显示模式:&nbsp;</td>
                        <td align="left">
                            <input type="radio" name="viewtype" id="viewtype0" value="0"/>普通&nbsp;&nbsp;
			        		<input type="radio" name="viewtype" id="viewtype1" value="1"/>直接打开附件&nbsp;&nbsp;
			        		<input type="radio" name="viewtype" id="viewtype2" value="2"/>大表格模式&nbsp;&nbsp;
			        		<input type="radio" name="viewtype" id="viewtype3" value="3"/>超大表格显示&nbsp;&nbsp;
			        		<input type="radio" name="viewtype" id="viewtype4" value="4"/>直接显示word文档&nbsp;&nbsp;
			        		<input type="hidden" name="_isfile" id="_isfile" value="<%=_isfile %>"/>
                        </td>
                        </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_smallPicUrl" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;小图片:&nbsp;</td>
                        <td valign="top" colspan="2">
                          <textarea name="_smallPicUrl" id="_smallPicUrl" cols="70%" rows="2" class="ckeditor"><%=_smallPicUrl%></textarea>
                          <script type="text/javascript">
							var editor=
					  		CKEDITOR.replace( '_smallPicUrl',
						     {
					  			width:'580',
							    height : '410',
							    toolbar : 'MyToolbar3',
							    filebrowserBrowseUrl        : '<%=basePath%>ckfinder/ckfinder.html',
					  	        filebrowserImageBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Images',
					  	        filebrowserFlashBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Flash',
					  	        filebrowserUploadUrl        : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
					  	        filebrowserImageUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
					  	        filebrowserFlashUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						     });
						     CKFinder.SetupCKEditor(editor);
						  </script>
                        </td>
                      </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="id_uploadFile" style='display: none;'>
                        <table width="100%"><tr>
                        <td width="20%" valign="top" align="right">&nbsp;&nbsp;上传附件:&nbsp;
                        <div id="id_isFile" style='display: none;'><font color="#FF0000">(必填)</font></div></td>
                         <td valign="top" colspan="2">
                          <textarea name="_uploadFile" id="_uploadFile" cols="70%" rows="2" class="ckeditor"><%=_uploadFile%></textarea>
                          <script type="text/javascript">
							var editor=
					  		CKEDITOR.replace( '_uploadFile',
						     {
					  			width:'600',
							    height : '80',
							    toolbar : 'MyToolbar5',
							    filebrowserBrowseUrl        : '<%=basePath%>ckfinder/ckfinder.html',
					  	        filebrowserImageBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Images',
					  	        filebrowserFlashBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Flash',
					  	        filebrowserUploadUrl        : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
					  	        filebrowserImageUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
					  	        filebrowserFlashUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						     });
						     CKFinder.SetupCKEditor(editor);
						  </script>
                        </td>
                        </tr></table>
                      </div></td>
                      </tr>
                      <tr>
                      <td colspan="2"><div id="idcontent" style='display: none;'>
                        <table width="100%">
                        <tr><td width="20%" valign="top" align="right">&nbsp;&nbsp;&nbsp;正文:&nbsp;</td>
                        <td valign="top" colspan="2">
                         <textarea name="content" id="content" cols="75%" rows="2" class="ckeditor"><%=content%></textarea>
                          <script type="text/javascript">
							 var _height= Ext.get("component").getHeight()-820;
							var editor=
					  		CKEDITOR.replace( 'content',
						     {
					  			width:'800',
							    height : _height,
					  			filebrowserBrowseUrl        : '<%=basePath%>ckfinder/ckfinder.html',
					  	        filebrowserImageBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Images',
					  	        filebrowserFlashBrowseUrl   : '<%=basePath%>ckfinder/ckfinder.html?Type=Flash',
					  	        filebrowserUploadUrl        : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
					  	        filebrowserImageUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
					  	        filebrowserFlashUploadUrl   : '<%=basePath%>ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						     });
							 CKFinder.SetupCKEditor(editor);
                          </script>
                        </td></tr>
                        </table>
                      </div></td>
                      </tr>
                    </table> 
  			      </div>
				</td>
			   </tr>
			  </table>
			 </div>
			</form>
		</div>
		<script type="text/javascript">
			var _cid = document.getElementById('cid').value;
//			document.getElementById('xt').style.height = Ext.get("component").getHeight()-28+"px";
		window.onload = function () {
        setTimeout("initpage()", "2000");//2秒后执行
      }
		</script>
		</div>
	</body>
</html>
